package com.ericsson.common.util;

public class ByteUtil
{
	public static String byte2String(byte[] in)
	{
		String out="";
		String tmp;
		int i;
		int a;
		for(i=0;i<in.length;i++)
		{
			a=in[i]&0xFF;
			tmp=Integer.toHexString(a);
			if (tmp.length()==1)
			{
				tmp="0"+tmp;
			}
			out+=tmp+" ";
		}
		return out;
	}
	
	public static int byte2Int(byte[] in,int start,int length)
	{
		int a=0;
		int i;

		for ( i =start; i<start+length ; i++) {   
  
			a=a<<8;
            a+= (in[i] & 0xFF);   
             
        }  
		return a;
	}
}
